
# LLVM_ROOT := $(HOME)/soft/llvm-10
LLVM_ROOT := /home/long/tmp/llvm_10_install
test_file := as.cc
test_file :=  new-simple-as.cc one-inst-asm-streamer.cc
obj_files :=  \
dyn-asmmber-streamer.o \
new-simple-as.o  \
fake_ncurses.o

# one-inst-asm-streamer.o \

link_libs := \
-lLLVMWindowsManifest \
-lLLVMTableGen \
-lLLVMSymbolize \
-lLLVMDebugInfoPDB \
-lLLVMOrcJIT \
-lLLVMOrcError \
-lLLVMJITLink \
-lLLVMObjectYAML \
-lLLVMMCA \
-lLLVMLTO \
-lLLVMPasses \
-lLLVMObjCARCOpts \
-lLLVMLineEditor \
-lLLVMLibDriver \
-lLLVMInterpreter \
-lLLVMFuzzMutate \
-lLLVMFrontendOpenMP \
-lLLVMMCJIT \
-lLLVMExecutionEngine \
-lLLVMRuntimeDyld \
-lLLVMDWARFLinker \
-lLLVMDlltoolDriver \
-lLLVMOption \
-lLLVMDebugInfoGSYM \
-lLLVMCoverage \
-lLLVMCoroutines \
-lLLVMRISCVDisassembler \
-lLLVMRISCVCodeGen \
-lLLVMRISCVAsmParser \
-lLLVMRISCVDesc \
-lLLVMRISCVUtils \
-lLLVMRISCVInfo \
-lLLVMARMDisassembler \
-lLLVMARMCodeGen \
-lLLVMARMAsmParser \
-lLLVMARMDesc \
-lLLVMARMUtils \
-lLLVMARMInfo \
-lLLVMMIRParser \
-lLLVMipo \
-lLLVMInstrumentation \
-lLLVMVectorize \
-lLLVMLinker \
-lLLVMIRReader \
-lLLVMAsmParser \
-lLLVMAArch64Disassembler \
-lLLVMMCDisassembler \
-lLLVMAArch64CodeGen \
-lLLVMCFGuard \
-lLLVMGlobalISel \
-lLLVMSelectionDAG \
-lLLVMAsmPrinter \
-lLLVMDebugInfoDWARF \
-lLLVMCodeGen \
-lLLVMTarget \
-lLLVMScalarOpts \
-lLLVMInstCombine \
-lLLVMAggressiveInstCombine \
-lLLVMTransformUtils \
-lLLVMBitWriter \
-lLLVMAnalysis \
-lLLVMProfileData \
-lLLVMObject \
-lLLVMTextAPI \
-lLLVMBitReader \
-lLLVMCore \
-lLLVMRemarks \
-lLLVMBitstreamReader \
-lLLVMAArch64AsmParser \
-lLLVMMCParser \
-lLLVMAArch64Desc \
-lLLVMMC \
-lLLVMDebugInfoCodeView \
-lLLVMDebugInfoMSF \
-lLLVMBinaryFormat \
-lLLVMAArch64Utils \
-lLLVMAArch64Info \
-lLLVMSupport \
-lLLVMDemangle \
-lLLVMXRay \

	# g++ -g -fpermissive -I$(LLVM_ROOT)/include -L/home/long/tmp/llvm/llvm-10.0.0.src/build/lib \

build: $(obj_files)
	g++ -g -fpermissive -I$(LLVM_ROOT)/include -L$(LLVM_ROOT)/lib \
	 $^ \
	 $(link_libs) \
	-lpthread \
	-o test.elf

	# -lz \
	# -lncurses \

clean:
	rm *.o *.elf -f

%.o: %.cc
	g++ -g -fpermissive -I$(LLVM_ROOT)/include -c -o $@ $^


%.o: %.c
	gcc -g -fpermissive -I$(LLVM_ROOT)/include -c -o $@ $^
